package jdk5_new_features;



import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Map;

/*
 *@Description TODO
 *@Author llt
 *@Date 2021/5/28 11:03
 *@Version 1.0
 */
public class DemoTest {


    public void doubleTest(){
        Double[] tem = {12.07, 25.87, 38.62, 45.18, 53.04, 61.85, 59.9, 32.3, 24.83};
        int startPoint = 10;
        int endPoint = 21;
        BigDecimal space = new BigDecimal("4.5");
        int index = new BigDecimal(startPoint).divideToIntegralValue(space).intValue();

        int start = new BigDecimal(startPoint).divide(space,BigDecimal.ROUND_UP).intValue();
        int end = new BigDecimal(endPoint).divide(space,BigDecimal.ROUND_UP).intValue();

        Double[] arr = Arrays.asList(tem).subList(start,end).toArray(new Double[0]);

        System.out.println("-----start =" + start);
        System.out.println("-----end =" + end);

        System.out.println("-----arr =" + Arrays.asList(arr).toString());

        try {
            System.out.println("-----1 ====" );
        } finally {
            System.out.println("-----2 ====" );
        }


    }





}
